Crate webtype

source ·
Expand description

Parser for fonts in Web Open Font Format.

Example

use webtype::opentype::truetype::FontHeader;
use webtype::File;

macro_rules! ok(($result:expr) => ($result.unwrap()));

let path = "NotoNaskhArabic-Regular.woff2";
let mut tape = ok!(std::fs::File::open(path));
let File { mut fonts, mut tape } = ok!(File::read(&mut tape));

let font_header = ok!(ok!(fonts[0].take::<_, FontHeader>(&mut tape)));
assert_eq!(font_header.units_per_em, 2048);

Re-exports

Modules

Structs

  • A file.
  • A font.
  • A four-byte unsigned integer with a variable-length encoding.

Traits

  • A type that can read.
  • A type that can be read.
  • A type that can be read given a parameter.

Functions

  • Check if a tag is recognized.

Type Definitions